package org.xiaojinlong.spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author Jin Long
 * 2015/8/25
 */
@Component("duke")
public class Juggler implements Performer {
    private int beanBags = 3;
    public Juggler() { }
    public Juggler(int bags) {
        beanBags = bags;
    }
    @Override
    public void perform(){
        System.out.println("JUGGLING " + beanBags + " BEANBAGS");
    }
}

interface Performer {
    void perform();
}

class Stage {
    @Autowired
    private Performer performer;
    private Stage() { }

    private static class StageSingletonHolder { // initialization on demand holder
        static Stage instance = new Stage();
    }

    public void say() {
        System.out.println("say");
    }
}